use SmallShop;

go

create table Product(
	Id bigint primary key,
	[Title] nvarchar(50) not null,
	[ImgUrl] nvarchar(200),
	[CateId] bigint,
	[Price] decimal(18,2),
	[Unit] nvarchar(50),
	[PackingId] bigint,
	[IsShowInHome] bit,
	[Weight] int,
	[Status] int,
	[CreateTime] DateTime DEFAULT (getdate()),
	[LastUpdateTime] DateTime DEFAULT (getdate()),
	[IsDelete] bit DEFAULT(0)
);

go
create table ProductPicture(
	[Id] bigint primary key,
	[Urls] ntext,
	[CreateTime] DateTime DEFAULT (getdate()),
	[LastUpdateTime] DateTime DEFAULT (getdate()),
	[IsDelete] bit DEFAULT(0)
);

go
create table Category(
	[Id] bigint primary key,
	[Title] nvarchar(50),
	[ParentId] bigint default(0),
	[CreateTime] DateTime DEFAULT (getdate()),
	[LastUpdateTime] DateTime DEFAULT (getdate()),
	[IsDelete] bit DEFAULT(0)
);


go
create table [Order](
	[Id] bigint primary key,
	[UserId] bigint,
	[ItemCount] int,
	[Amount] decimal(18,2),
	[Status] int,
	[PayStatsu] int,
	[Phone] nvarchar(200),
	[Addr] nvarchar(200),
	[Remark] nvarchar(500),
	[DeliverMethod] int,
	[CreateTime] DateTime DEFAULT (getdate()),
	[LastUpdateTime] DateTime DEFAULT (getdate()),
	[IsDelete] bit DEFAULT(0)
);

go
create table [OrderDetail](
	[Id] bigint primary key,
	[OrderId] bigint,
	[ItemId] bigint,
	[Price] decimal(18,2),
	[Quantity] int,
	[Unit] nvarchar(50),
	[Amount] decimal(18,2),
	[Total] decimal(18,2),
	[CreateTime] DateTime DEFAULT (getdate()),
	[LastUpdateTime] DateTime DEFAULT (getdate())
);

go
create table [ReceiptBill](
	[Id] bigint primary key,
	[Type] int,
	[Amount] decimal(18,2),
	[Satus] int,
	[PayMethod] int,
	[PayPhone] nvarchar(50),
	[Reponse] nvarchar(max),
	[PayNumber] nvarchar(50),
	[PayTime] DateTime,
	[CreateTime] DateTime DEFAULT (getdate()),
	[LastUpdateTime] DateTime DEFAULT (getdate()),
	[IsDelete] bit DEFAULT(0)
);


go
create table [Article](
	[Id] bigint primary key,
	[Title] nvarchar(100),
	[Summary] nvarchar(500),
	[VisitCount] int,
	[ImgUrl] nvarchar(200),
	[IsShow] bit,
	[Weight] int,
	[CreateTime] DateTime DEFAULT (getdate()),
	[LastUpdateTime] DateTime DEFAULT (getdate()),
	[IsDelete] bit DEFAULT(0)
);

go
create table [ArticleContent](
	[Id] bigint primary key,
	[Content] ntext,
	[CreateTime] DateTime DEFAULT (getdate()),
	[LastUpdateTime] DateTime DEFAULT (getdate()),
	[IsDelete] bit DEFAULT(0)
);

go
create table [Config](
	[Id] bigint primary key,
	[Content] ntext,
	[CreateTime] DateTime DEFAULT (getdate()),
	[LastUpdateTime] DateTime DEFAULT (getdate()),
	[IsDelete] bit DEFAULT(0)
);

go
create table [Banner](
	[Id] bigint primary key,
	[Title] nvarchar(100),
	[ImgUrl] nvarchar(200),
	[Url] nvarchar(200),
	[Sequence] int,
	[StartTime] DateTime,
	[EndTime] DateTime,
	[CreateTime] DateTime DEFAULT (getdate()),
	[LastUpdateTime] DateTime DEFAULT (getdate()),
	[IsDelete] bit DEFAULT(0)
);

go
create table [Manager](
	[Id] bigint primary key,
	[LoginName] nvarchar(100) not null,
	[Pwd] nvarchar(200),
	[Status] int,	
	[CreateTime] DateTime DEFAULT (getdate()),
	[LastUpdateTime] DateTime DEFAULT (getdate()),
	[IsDelete] bit DEFAULT(0)
)
